<template>
  <div class="home">
    <h1>Home Page</h1>
    <div v-if="loading">Loading...</div>
    <div v-else>{{ data }}</div>
  </div>
</template>

<script>
import api from '../api'

export default {
  name: 'Home',
  data() {
    return {
      loading: false,
      data: null
    }
  },
  async mounted() {
    try {
      this.loading = true
      // 示例API调用
      const response = await api.get('/example')
      this.data = response.data
    } catch (error) {
      console.error(error)
    } finally {
      this.loading = false
    }
  }
}
</script>
